﻿using System.Collections.Generic;
using System.Linq;

namespace MicroDb.Generate
{
    public class Table : BaseObj
    {
        /// <summary>
        /// 数据源名
        /// </summary>
        public string DBSource { get; set; }

        /// <summary>
        /// 表名
        /// </summary>
        public string TableName { get; set; }

        /// <summary>
        /// 列
        /// </summary>
        public Column[] Columns { get; set; }

        private string[] NameSpace { get; set; }


        public override string[] GetNameSpaces()
        {
            if (NameSpace == null)
            {
                NameSpace = base.GetNameSpaces().Concat(Columns.SelectMany(a => a.GetNameSpaces())).ToArray();
            }
            return NameSpace;
        }
    }
}
